package com.lcredu.springboot.mybatis.controller;

import com.lcredu.springboot.mybatis.entity.Monster;
import com.lcredu.springboot.mybatis.service.MonsterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 黎长容
 * @date 2025-08-18 16:38
 */
@Controller
public class MonsterController {
    @Autowired
    private MonsterService monsterService;


    //接口-根据id得到对象
    @GetMapping("/getMonster")
    @ResponseBody
    public Monster getMonster(@RequestParam("id") Integer id) {
        Monster monster = monsterService.getMonsterById(id);
        return monster;
    }

}
